#define _CRT_SECURE_NO_WARNINGS 1

namespace zy
{
	template<class K, class Hash = HashFunc<K>>
	class unordered_set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename hash_bucket::HashTable<K, const K, SetKeyOfT, Hash>::Iterator iterator;
		typedef typename hash_bucket::HashTable<K, const K, SetKeyOfT, Hash>::Const_Iterator const_iterator;
		
		const_iterator begin() const
		{
			return _ht.Begin();
		}
		const_iterator end() const
		{
			return _ht.End();
		}
		iterator begin()
		{
			return _ht.Begin();
		}
		iterator end()
		{
			return _ht.End();
		}


		pair<iterator,bool> insert(const K& key)
		{
			return _ht.Insert(key);
		}

		


	private:
		hash_bucket::HashTable<K, const K, SetKeyOfT, Hash> _ht;
	};

	void func(const unordered_set<int>& s)
	{
		unordered_set<int>::const_iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}

	void test_unordered_set()
	{
		unordered_set<int> s;
		s.insert(1);
		s.insert(4);
		s.insert(3);
		s.insert(2);
		func(s);

		//unordered_set<int>::iterator it = s.begin();
		//while (it != s.end())
		//{
		//	cout << *it << " ";
		//	//*it = 1;
		//	++it;
		//}
		//cout << endl;

		//it = s.begin();
		//while (it != s.end())
		//{
		//	cout << *it << " ";
		//	++it;
		//}
		//cout << endl;
	}
}

